A typical electronic device that includes a nonvolatile storage device serving as the MTD may be, for example, an image forming apparatus including a random access memory (RAM) and a flash memory serving as the nonvolatile storage device.
FIG. 10 is a schematic diagram illustrating an example of a configuration of a RAM 81 and a flash memory 82 within such a typical electronic device 80 as described above.
As illustrated in FIG. 10, the electronic device 80 includes the RAM 81 and the flash memory 82 serving as a nonvolatile storage device.
The flash memory 82 stores firmware 82a for a Linux® system.
The firmware 82a includes a boot loader 82b that is executed when the electronic device 80 is booted, a kernel 82c to be expanded onto the RAM 81, a root disk image 82d for normal boot that is a root disk image serving as a compressed file of a root file system and that is used when a boot mode of the electronic device 80 is a normal boot mode, and a root disk image 82e for update that is a root disk image used when the boot mode of the electronic device 80 is an update mode for updating the firmware 82a on the flash memory 82.
The root disk image 82d for normal boot is a file having a format that can be read by a kernel 81c described later from the MTD via a read-only file system such as Cramfs or Squashfs. On the other hand, the root disk image 82e for update is a file having a format that can be read by the kernel 81c from an area of the RAM 81 under management of the kernel 81c. The format that can be read by the kernel 81c from the MTD is different from the format that can be read by the kernel 81c from the area of the RAM 81 under the management of the kernel 81c in terms of a mechanism of Linux®. In other words, the root disk image 82d for normal boot and the root disk image 82e for update are files having formats different from each other.
FIG. 11 is a flowchart of an operation performed when the electronic device 80 is booted. FIG. 12 is a schematic diagram illustrating a configuration of the RAM 81 and the flash memory 82 employed when the boot mode of the electronic device 80 is the normal boot mode. FIG. 13 is a schematic diagram illustrating a configuration of the RAM 81 and the flash memory 82 employed when the boot mode of the electronic device 80 is the update mode.
As illustrated in FIG. 11, when booted, the electronic device 80 expands the boot loader 82b on the flash memory 82 onto the RAM 81 as a boot loader 81b (refer to FIG. 12 and FIG. 13) (S91).
Subsequently, the boot loader 81b expands the kernel 82c on the flash memory 82 onto the RAM 81 as the kernel 81c (refer to FIG. 12 and FIG. 13) (S92).
Subsequently, the boot loader 81b determines whether or not the boot mode of the electronic device 80 is the update mode (S93).
When determining in Step S93 that the boot mode is not the update mode—that is, when the boot mode is the normal boot mode—the boot loader 81b notifies the kernel 81c that the boot mode is the normal boot mode (S94).
When notified by the boot loader 81b that the boot mode is the normal boot mode, the kernel 81c mounts the root disk image 82d for normal boot on the flash memory 82 as the root file system (S95). Accordingly, as illustrated in FIG. 12, the root disk image 82d for normal boot is read into an area of the RAM 81 not under the management of the kernel 81c in unit of a page as the need arises.
When determining in Step S93 that the boot mode is the update mode, the boot loader 81b notifies the kernel 81c that the boot mode is the update mode (S96).
When notified by the boot loader 81b that the boot mode is the update mode, as illustrated in FIG. 13, the kernel 81c expands the root disk image 82e for update on the flash memory 82 into the area of the RAM 81 under the management of the kernel 81c as a root disk image 81e for update (S97), and then mounts the root disk image 81e for update on the RAM 81 as the root file system (S98). Accordingly, as illustrated in FIG. 13, the root disk image 81e for update is read into the area of the RAM 81 not under the management of the kernel 81c in unit of the page as the need arises. Note that, the electronic device 80 operates in accordance with the root disk image 81e for update on the RAM 81, and hence can delete the firmware 82a before update from the flash memory 82 and then write the firmware 82a after update into the flash memory 82.
When the process of Step S95 or Step S98 is finished, the electronic device 80 finishes the operation illustrated in FIG. 11.
However, on the electronic device 80, two kinds of root disk images, the root disk image 82d for normal boot and the root disk image 82e for update, need to be stored in the flash memory 82, which increases a capacity necessary for the flash memory 82.